<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<!DOCTYPE html>
<html lang="zh-cn">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
    <meta name="renderer" content="webkit">
    <title>查看</title>
    <link rel="stylesheet" href="css/pintuer.css">
    <link rel="stylesheet" href="css/admin.css">
    <script src="js/jquery.js"></script>
    <script src="js/pintuer.js"></script>
</head>
<body>
<form method="post" action="" id="listform">
    <div class="panel admin-panel">
        <div class="panel-head"><strong class="icon-reorder"> 用户列表</strong> <a href=""
                                                                               style="float:right; display:none;">添加字段</a>
        </div>
        <div class="padding border-bottom">
            <ul class="search" style="padding-left:10px;">
                <li>
                    <form action="/searchAjax" method="post">
                        用户名:
                        <input type="text" placeholder="请输入搜索关键字" name="str" class="input"
                               style="width:250px; line-height:17px;display:inline-block"/>
                        手机号:
                        <input type="text" placeholder="请输入搜索关键字" name="keywords" class="input"
                               style="width:250px; line-height:17px;display:inline-block"/>
                        <button  class="button border-main icon-search" onclick="changesearch()"> 搜索</button>
                    </form>
                </li>
            </ul>
        </div>
        <table class="table table-hover text-center">
            <tr>
                <th width="100" style="text-align:left; padding-left:20px;">编号</th>
                <th width="10%">ID</th>
                <th width="10%">姓名</th>
                <th>密码</th>
                <th width="310">操作</th>
            </tr>
            <c:forEach items="${sessionScope.us}" var="u" varStatus="c">
                <tr>
                    <td style="text-align:left; padding-left:20px;">${c.count}</td>
                    <td>${u.id}</td>
                    <td>${u.name}</td>
                    <td>${u.password}</td>
                    <td>
                    <td>
                        <div class="button-group"><a class="button border-main" href="/updateController?id=${u.id}">
                            <span class="icon-edit"></span> 修改</a>
                            <a class="button border-red" href="/deleteServlet?id=${u.id}"
                               onclick="return del(1)"><span class="icon-trash-o"></span> 删除</a></div>
                    </td>
                </tr>
                </td>
                </tr>
            </c:forEach>

        </table>
        <%--        <c:if test="${pagenum>1}">--%>
        <%--            <a href="/static/listByPageController?pagenum=1">首页</a>--%>

        <%--            <a href="/static/listByPageController?pagenum=${pagenum-1}&size=3">上一页</a>--%>
        <%--        </c:if>--%>
        <%--        <a href="/static/listByPageController?pagenum=1&size=3">1</a>--%>
        <%--        <a href="/static/listByPageController?pagenum=2&size=3">2</a>--%>
        <%--        <a href="/static/listByPageController?pagenum=3&size=3">3</a>--%>
        <%--        <a href="/static/listByPageController?pagenum=4&size=3">4</a>--%>
        <%--        <a href="/static/listByPageController?pagenum=5&size=3">5</a>--%>
        <%--        <c:if test="${pagenum<to}">--%>

        <%--            <a href="/static/listByPageController?pagenum=${pagenum+1}&size=3">下一页</a>--%>

        <%--            <a href="/static/listByPageController?pagenum=${sessionScope.to}&size=3">尾页</a>--%>
        <%--        </c:if>--%>
        <%--        共${sessionScope.to }页，${ sessionScope.total}条记--%>
    </div>
</form>
<script type="text/javascript">

    //搜索
    function changesearch() {

    }

    //单个删除
    function del(id, mid, iscid) {
        if (confirm("您确定要删除吗?")) {

        }
    }

    //全选
    $("#checkall").click(function () {
        $("input[name='id[]']").each(function () {
            if (this.checked) {
                this.checked = false;
            } else {
                this.checked = true;
            }
        });
    })

    //批量删除
    function DelSelect() {
        var Checkbox = false;
        $("input[name='id[]']").each(function () {
            if (this.checked == true) {
                Checkbox = true;
            }
        });
        if (Checkbox) {
            var t = confirm("您确认要删除选中的内容吗？");
            if (t == false) return false;
            $("#listform").submit();
        } else {
            alert("请选择您要删除的内容!");
            return false;
        }
    }

    //批量排序
    function sorts() {
        var Checkbox = false;
        $("input[name='id[]']").each(function () {
            if (this.checked == true) {
                Checkbox = true;
            }
        });
        if (Checkbox) {

            $("#listform").submit();
        } else {
            alert("请选择要操作的内容!");
            return false;
        }
    }


    //批量首页显示
    function changeishome(o) {
        var Checkbox = false;
        $("input[name='id[]']").each(function () {
            if (this.checked == true) {
                Checkbox = true;
            }
        });
        if (Checkbox) {

            $("#listform").submit();
        } else {
            alert("请选择要操作的内容!");

            return false;
        }
    }

    //批量推荐
    function changeisvouch(o) {
        var Checkbox = false;
        $("input[name='id[]']").each(function () {
            if (this.checked == true) {
                Checkbox = true;
            }
        });
        if (Checkbox) {


            $("#listform").submit();
        } else {
            alert("请选择要操作的内容!");

            return false;
        }
    }

    //批量置顶
    function changeistop(o) {
        var Checkbox = false;
        $("input[name='id[]']").each(function () {
            if (this.checked == true) {
                Checkbox = true;
            }
        });
        if (Checkbox) {

            $("#listform").submit();
        } else {
            alert("请选择要操作的内容!");

            return false;
        }
    }


    //批量移动
    function changecate(o) {
        var Checkbox = false;
        $("input[name='id[]']").each(function () {
            if (this.checked == true) {
                Checkbox = true;
            }
        });
        if (Checkbox) {

            $("#listform").submit();
        } else {
            alert("请选择要操作的内容!");

            return false;
        }
    }

    //批量复制
    function changecopy(o) {
        var Checkbox = false;
        $("input[name='id[]']").each(function () {
            if (this.checked == true) {
                Checkbox = true;
            }
        });
        if (Checkbox) {
            var i = 0;
            $("input[name='id[]']").each(function () {
                if (this.checked == true) {
                    i++;
                }
            });
            if (i > 1) {
                alert("只能选择一条信息!");
                $(o).find("option:first").prop("selected", "selected");
            } else {

                $("#listform").submit();
            }
        } else {
            alert("请选择要复制的内容!");
            $(o).find("option:first").prop("selected", "selected");
            return false;
        }
    }

</script>
</body>
</html>